package com.ex3.ylw.connector.http;

import com.util.PackagePath;
import org.apache.catalina.util.StringManager;

import java.io.IOException;
import java.io.InputStream;

/**
 * 更有效的读取http头信息，在处理http头信息是按行读取
 * Created by yangliwei on 2017/7/25.
 */
public class SocketInputStream extends InputStream{

    // -------------------------------------------------------------- Constants


    /**
     * CR.
     */
    private static final byte CR = (byte) '\r';


    /**
     * LF.
     */
    private static final byte LF = (byte) '\n';


    /**
     * SP.
     */
    private static final byte SP = (byte) ' ';


    /**
     * HT.
     */
    private static final byte HT = (byte) '\t';


    /**
     * COLON.
     */
    private static final byte COLON = (byte) ':';


    /**
     * Lower case offset.
     */
    private static final int LC_OFFSET = 'A' - 'a';


    /**
     * Internal buffer.
     */
    protected byte buf[];


    /**
     * Last valid byte.
     */
    protected int count;

    /**
     * The string manager for this package.
     */
    protected static StringManager sm =
            StringManager.getManager(PackagePath.EX3.getPath());


    /**
     * Position in the buffer.
     */
    protected int pos;

    public SocketInputStream(InputStream is, int bufferSize) {

        this.is = is;
        buf = new byte[bufferSize];

    }


    /**
     * Underlying input stream.
     */
    protected InputStream is;
    @Override
    public int read() throws IOException {
        return 0;
    }
}
